import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from "./router";
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import PublicAPI from "@/axios/public";
import 'element-plus/dist/index.css'
import './assets/css/global.less';
import { createPinia } from "pinia";
import bus from "./mitt";
import useCounterStore from "@/store/user";
//此 可以拿到pinia中state的数据
import { storeToRefs } from 'pinia';

const pinia = createPinia();

//可 拿取到整个pinia对象
const store = useCounterStore()
const storerefs = storeToRefs(store)




const app = createApp(App)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(pinia)
app.use(router)
app.use(ElementPlus)

//
// app.provide('store_state', storerefs)
app.provide('store', store)
// app.provide('bus', bus)
app.config.globalProperties.$PublicAPI = PublicAPI
app.config.globalProperties.$store = store
app.config.globalProperties.$store_state = storerefs
app.config.globalProperties.$bus = bus


app.mount('#app')





